![]() |
BlueSpray - Help
©
SchoonerTurtles, Inc. 2012-2015 |
|||||||||
|
|
||||||||||
|
Writing ExtensionsReading and Writing PropertiesAny objects with proprety values should override GetProperties() and SetProperties() to read and write their property values. This is accomplished by providing a Key/Value pair that is writting to an XML tags attributes and then read back when the object's properties are imported. Objects that contain other objects should also override GetContainedObjectsProperties() and SetContainedObjectProperties() to read and write the properties for those objects. You should not use the following key values (names of attributes/properties):
GetProperties()if (NewDocument!=true) TheSettings.Add("NewDocument",NewDocument); SetProperties()NewDocument=TheSettings.Get("NewDocument",NewDocument); GetContainedObjectsProperties()Override this function to write contained objects into the XML string. public String GetContainedObjectsProperties(int TheLevel) throws Exception TheContent=super.GetContainedObjectsProperties(TheLevel); if (TheDefaultStyle!=null) TheContent=TheDefaultStyle.WriteToSTX(TheContent, TheLevel); SetContainedObjectProperties()Below is a sample of overriding this function for a class that contains other objects. The ContainerClassName should match this classes simple name. The ContainedObjectClassName can be used to determine the type of object to create while ObjectName can be used to distinguish between different objects of the same type in the same class. public int SetContainedObjectProperties(String ContainedObjectClassName,String ContainerClassName, IndexStart=Temp.LoadFromString(TheString, IndexStart); if (Temp.GetName().equals("DefaultStyle")) TheDefaultStyle=Temp;
return(IndexStart);
|
|||||||||